
/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"5DFBC655-3119-4B15-A8D1-01482E5562E0"}
 */
function onShow(firstShow, event) {
	databaseManager.setAutoSave(false)
	controller.newRecord()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"0FB2A9F6-4274-46AA-A528-26B7DBFD9C16"}
 */
function confirmar(event) {
	if (databaseManager.saveData() == false)
	{
		globals.DIALOGS.showErrorDialog('Error','No se pudo grabar. Verifique que el nro de socio no este duplicado','OK')
		return
	}
	databaseManager.setAutoSave(true)
	var $win = application.getWindow('ALTA_SOCIO')
	$win.hide()
	$win.destroy()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"3111F1B4-0675-49B5-93F6-7E63BD33B292"}
 */
function cancelar(event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	var $win = application.getWindow('ALTA_SOCIO')
	$win.hide()
	$win.destroy()
}

/**
 * Handle hide window.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"B344CDE5-A123-4D17-A775-DDEF4A5F20E1"}
 */
function onHide(event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	return true
}
